find the total distance traveled